package com.qfedu.web;

import com.qfedu.pojo.Cards;
import com.qfedu.service.CardsService;
import com.qfedu.service.impl.CardsServiceImpl;
import org.junit.jupiter.api.Test;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class CardsServlet extends BaseServlet {

    private CardsService cardsService=new CardsServiceImpl();

    @Test
    public void queryCardsByIdcode() throws ServletException, IOException {
       // String idcode = request.getParameter("idcode");
       // Cards cards = cardsService.queryCardsByIdcode(idcode);
        Cards cards = cardsService.queryCardsByIdcode("152104199909011234");
        if(cards != null){
            System.out.println("有此用户");
           // System.out.println("------cards-------"+cards);
           // request.setAttribute("cardslist",cards);
            // 转发
          //  request.getRequestDispatcher("/").forward(request,response);
        }else{
            System.out.println("没有此用户");
        }
    }

   public void findCardsByIdcode(HttpServletRequest request,HttpServletResponse response){
       String idcode = request.getParameter("idcode");
       Cards cardsByIdcode = cardsService.findCardsByIdcode(idcode);
       if(cardsByIdcode != null){
           System.out.println("有此用户");

       }else{
           System.out.println("没有此用户");
       }
   }
}
